package leetcode.code1540;

import java.util.Arrays;
import java.util.HashSet;
import java.util.Set;

import leetcode.IDebug;
import leetcode.helper.H;

// 1. 两个串未必一样长
// 2. 
public class Solution implements IDebug {

	public boolean canConvertString(String s, String t, int k) {
		if (s.length() != t.length()) {
			return false;
		}
		int[] set = new int[26];
		for (int i = 0; i < set.length; i++) {
			set[i] = i;
		}
		for (int i = 0; i < s.length(); i++) {
			int diff = (t.charAt(i) - s.charAt(i) + 26) % 26;
			if (diff == 0) {
				continue;
			}
			if (set[diff] > k) {
				return false;
			}
			set[diff] += 26;
		}
		return true;
	}

	@Override
	public void debug4() {
		H.compare(false, this.canConvertString("atmtxzjkz", "tvbtjhvjd", 35));
	}

	@Override
	public void debug3() {
		// TODO Auto-generated method stub

	}

	@Override
	public void debug2() {
		// TODO Auto-generated method stub

	}

	@Override
	public void debug1() {
		// TODO Auto-generated method stub

	}

	public static void main(String[] args) {
		Solution so = new Solution();
		so.debug1();
		so.debug2();
		so.debug3();
		so.debug4();

	}

}
